﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace hondaab.portal.menu_dir
{
    public partial class menuUsuario : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["cesta"] != null)
            {
                List<lineaspedidos> lista = new List<lineaspedidos>();
                lista = (List<lineaspedidos>)HttpContext.Current.Session["cesta"];
                int x = 0;
                foreach (lineaspedidos art in lista)
                {
                    x = x + art.cantidad;
                }
                litListaArticulos2.Text = x.ToString();
                litListaArticulos.Text = x.ToString();
            }
            if (sf.cadena(HttpContext.Current.Session["dcliente"]) != "")
            {
            
                PanelOn.Visible = true;
                PanelOff.Visible = false;
                lituser.Text = clientes.getNombre(sf.entero(HttpContext.Current.Session["dcliente"]));
            }
            else
            {
                PanelOn.Visible = false;
                PanelOff.Visible = true;
            }

        }
 
        protected void btnsalir_Click(object sender, EventArgs e)
        {
            HttpContext.Current.Session["cesta"] = null; 
            HttpContext.Current.Session["dcliente"] = null;
            Response.Redirect("../market/main_market.aspx");
        }
        public void actualizarCantidad(int x)
        {
            litListaArticulos2.Text = x.ToString();
            litListaArticulos.Text = x.ToString();
        }
    }
}